﻿using System;
using System.Collections.Generic;
using Helpers;
using TaleWorlds.CampaignSystem.Actions;
using TaleWorlds.CampaignSystem.ComponentInterfaces;
using TaleWorlds.CampaignSystem.Conversation;
using TaleWorlds.CampaignSystem.GameMenus;
using TaleWorlds.CampaignSystem.GameState;
using TaleWorlds.CampaignSystem.Party;
using TaleWorlds.CampaignSystem.Roster;
using TaleWorlds.CampaignSystem.Settlements;
using TaleWorlds.CampaignSystem.Settlements.Locations;
using TaleWorlds.Core;
using TaleWorlds.Library;
using TaleWorlds.Localization;
using TaleWorlds.ObjectSystem;
using TaleWorlds.SaveSystem;

namespace TaleWorlds.CampaignSystem.Issues
{
	// Token: 0x020002F7 RID: 759
	public abstract class IssueBase : MBObjectBase
	{
		// Token: 0x06002BED RID: 11245 RVA: 0x000B9150 File Offset: 0x000B7350
		protected override void AutoGeneratedInstanceCollectObjects(List<object> collectedObjects)
		{
			base.AutoGeneratedInstanceCollectObjects(collectedObjects);
			collectedObjects.Add(this.AlternativeSolutionSentTroops);
			CampaignTime.AutoGeneratedStaticCollectObjectsCampaignTime(this.IssueDueTime, collectedObjects);
			CampaignTime.AutoGeneratedStaticCollectObjectsCampaignTime(this.IssueCreationTime, collectedObjects);
			collectedObjects.Add(this._companionRewardSkill);
			collectedObjects.Add(this._journalEntries);
			collectedObjects.Add(this._issueOwner);
			collectedObjects.Add(this._trackedObjects);
			CampaignTime.AutoGeneratedStaticCollectObjectsCampaignTime(this.AlternativeSolutionReturnTimeForTroops, collectedObjects);
			CampaignTime.AutoGeneratedStaticCollectObjectsCampaignTime(this.AlternativeSolutionIssueEffectClearTime, collectedObjects);
			collectedObjects.Add(this.IssueQuest);
		}

		// Token: 0x06002BEE RID: 11246 RVA: 0x000B91F0 File Offset: 0x000B73F0
		internal static object AutoGeneratedGetMemberValueAlternativeSolutionReturnTimeForTroops(object o)
		{
			return ((IssueBase)o).AlternativeSolutionReturnTimeForTroops;
		}

		// Token: 0x06002BEF RID: 11247 RVA: 0x000B9202 File Offset: 0x000B7402
		internal static object AutoGeneratedGetMemberValueAlternativeSolutionIssueEffectClearTime(object o)
		{
			return ((IssueBase)o).AlternativeSolutionIssueEffectClearTime;
		}

		// Token: 0x06002BF0 RID: 11248 RVA: 0x000B9214 File Offset: 0x000B7414
		internal static object AutoGeneratedGetMemberValueIssueQuest(object o)
		{
			return ((IssueBase)o).IssueQuest;
		}

		// Token: 0x06002BF1 RID: 11249 RVA: 0x000B9221 File Offset: 0x000B7421
		internal static object AutoGeneratedGetMemberValueIsTriedToSolveBefore(object o)
		{
			return ((IssueBase)o).IsTriedToSolveBefore;
		}

		// Token: 0x06002BF2 RID: 11250 RVA: 0x000B9233 File Offset: 0x000B7433
		internal static object AutoGeneratedGetMemberValueAlternativeSolutionSentTroops(object o)
		{
			return ((IssueBase)o).AlternativeSolutionSentTroops;
		}

		// Token: 0x06002BF3 RID: 11251 RVA: 0x000B9240 File Offset: 0x000B7440
		internal static object AutoGeneratedGetMemberValueIssueDueTime(object o)
		{
			return ((IssueBase)o).IssueDueTime;
		}

		// Token: 0x06002BF4 RID: 11252 RVA: 0x000B9252 File Offset: 0x000B7452
		internal static object AutoGeneratedGetMemberValueIssueCreationTime(object o)
		{
			return ((IssueBase)o).IssueCreationTime;
		}

		// Token: 0x06002BF5 RID: 11253 RVA: 0x000B9264 File Offset: 0x000B7464
		internal static object AutoGeneratedGetMemberValue_totalTroopXpAmount(object o)
		{
			return ((IssueBase)o)._totalTroopXpAmount;
		}

		// Token: 0x06002BF6 RID: 11254 RVA: 0x000B9276 File Offset: 0x000B7476
		internal static object AutoGeneratedGetMemberValue_companionRewardSkill(object o)
		{
			return ((IssueBase)o)._companionRewardSkill;
		}

		// Token: 0x06002BF7 RID: 11255 RVA: 0x000B9283 File Offset: 0x000B7483
		internal static object AutoGeneratedGetMemberValue_journalEntries(object o)
		{
			return ((IssueBase)o)._journalEntries;
		}

		// Token: 0x06002BF8 RID: 11256 RVA: 0x000B9290 File Offset: 0x000B7490
		internal static object AutoGeneratedGetMemberValue_issueState(object o)
		{
			return ((IssueBase)o)._issueState;
		}

		// Token: 0x06002BF9 RID: 11257 RVA: 0x000B92A2 File Offset: 0x000B74A2
		internal static object AutoGeneratedGetMemberValue_issueOwner(object o)
		{
			return ((IssueBase)o)._issueOwner;
		}

		// Token: 0x06002BFA RID: 11258 RVA: 0x000B92AF File Offset: 0x000B74AF
		internal static object AutoGeneratedGetMemberValue_issueDifficultyMultiplier(object o)
		{
			return ((IssueBase)o)._issueDifficultyMultiplier;
		}

		// Token: 0x06002BFB RID: 11259 RVA: 0x000B92C1 File Offset: 0x000B74C1
		internal static object AutoGeneratedGetMemberValue_areIssueEffectsResolved(object o)
		{
			return ((IssueBase)o)._areIssueEffectsResolved;
		}

		// Token: 0x06002BFC RID: 11260 RVA: 0x000B92D3 File Offset: 0x000B74D3
		internal static object AutoGeneratedGetMemberValue_alternativeSolutionCasualtyCount(object o)
		{
			return ((IssueBase)o)._alternativeSolutionCasualtyCount;
		}

		// Token: 0x06002BFD RID: 11261 RVA: 0x000B92E5 File Offset: 0x000B74E5
		internal static object AutoGeneratedGetMemberValue_failureChance(object o)
		{
			return ((IssueBase)o)._failureChance;
		}

		// Token: 0x06002BFE RID: 11262 RVA: 0x000B92F7 File Offset: 0x000B74F7
		internal static object AutoGeneratedGetMemberValue_trackedObjects(object o)
		{
			return ((IssueBase)o)._trackedObjects;
		}

		// Token: 0x17000AB9 RID: 2745
		// (get) Token: 0x06002BFF RID: 11263 RVA: 0x000B9304 File Offset: 0x000B7504
		protected virtual bool IssueQuestCanBeDuplicated
		{
			get
			{
				return false;
			}
		}

		// Token: 0x17000ABA RID: 2746
		// (get) Token: 0x06002C00 RID: 11264 RVA: 0x000B9307 File Offset: 0x000B7507
		// (set) Token: 0x06002C01 RID: 11265 RVA: 0x000B930F File Offset: 0x000B750F
		public virtual int RelationshipChangeWithIssueOwner { get; protected set; }

		// Token: 0x17000ABB RID: 2747
		// (get) Token: 0x06002C02 RID: 11266
		public abstract TextObject IssueBriefByIssueGiver { get; }

		// Token: 0x17000ABC RID: 2748
		// (get) Token: 0x06002C03 RID: 11267
		public abstract TextObject IssueAcceptByPlayer { get; }

		// Token: 0x17000ABD RID: 2749
		// (get) Token: 0x06002C04 RID: 11268 RVA: 0x000B9318 File Offset: 0x000B7518
		public virtual TextObject IssuePlayerResponseAfterLordExplanation
		{
			get
			{
				return new TextObject("{=sMCN7eCp}Is there any other way to solve this problem?", null);
			}
		}

		// Token: 0x17000ABE RID: 2750
		// (get) Token: 0x06002C05 RID: 11269 RVA: 0x000B9325 File Offset: 0x000B7525
		public virtual TextObject IssuePlayerResponseAfterAlternativeExplanation
		{
			get
			{
				return new TextObject("{=yrPEqZEa}Any other way?", null);
			}
		}

		// Token: 0x17000ABF RID: 2751
		// (get) Token: 0x06002C06 RID: 11270
		public abstract TextObject IssueQuestSolutionExplanationByIssueGiver { get; }

		// Token: 0x17000AC0 RID: 2752
		// (get) Token: 0x06002C07 RID: 11271 RVA: 0x000B9332 File Offset: 0x000B7532
		public virtual TextObject IssueAlternativeSolutionExplanationByIssueGiver
		{
			get
			{
				return TextObject.Empty;
			}
		}

		// Token: 0x17000AC1 RID: 2753
		// (get) Token: 0x06002C08 RID: 11272 RVA: 0x000B9339 File Offset: 0x000B7539
		public virtual TextObject IssueLordSolutionExplanationByIssueGiver
		{
			get
			{
				return TextObject.Empty;
			}
		}

		// Token: 0x17000AC2 RID: 2754
		// (get) Token: 0x06002C09 RID: 11273
		public abstract TextObject IssueQuestSolutionAcceptByPlayer { get; }

		// Token: 0x17000AC3 RID: 2755
		// (get) Token: 0x06002C0A RID: 11274 RVA: 0x000B9340 File Offset: 0x000B7540
		public virtual TextObject IssueAlternativeSolutionAcceptByPlayer
		{
			get
			{
				return TextObject.Empty;
			}
		}

		// Token: 0x17000AC4 RID: 2756
		// (get) Token: 0x06002C0B RID: 11275 RVA: 0x000B9347 File Offset: 0x000B7547
		public virtual TextObject IssueAlternativeSolutionResponseByIssueGiver
		{
			get
			{
				return TextObject.Empty;
			}
		}

		// Token: 0x17000AC5 RID: 2757
		// (get) Token: 0x06002C0C RID: 11276 RVA: 0x000B934E File Offset: 0x000B754E
		public virtual TextObject IssueLordSolutionAcceptByPlayer
		{
			get
			{
				return TextObject.Empty;
			}
		}

		// Token: 0x17000AC6 RID: 2758
		// (get) Token: 0x06002C0D RID: 11277 RVA: 0x000B9355 File Offset: 0x000B7555
		public virtual TextObject IssueLordSolutionResponseByIssueGiver
		{
			get
			{
				return TextObject.Empty;
			}
		}

		// Token: 0x17000AC7 RID: 2759
		// (get) Token: 0x06002C0E RID: 11278 RVA: 0x000B935C File Offset: 0x000B755C
		public virtual TextObject IssueLordSolutionCounterOfferBriefByOtherNpc
		{
			get
			{
				return TextObject.Empty;
			}
		}

		// Token: 0x17000AC8 RID: 2760
		// (get) Token: 0x06002C0F RID: 11279 RVA: 0x000B9363 File Offset: 0x000B7563
		public virtual TextObject IssueLordSolutionCounterOfferExplanationByOtherNpc
		{
			get
			{
				return TextObject.Empty;
			}
		}

		// Token: 0x17000AC9 RID: 2761
		// (get) Token: 0x06002C10 RID: 11280 RVA: 0x000B936A File Offset: 0x000B756A
		public virtual TextObject IssueLordSolutionCounterOfferAcceptByPlayer
		{
			get
			{
				return TextObject.Empty;
			}
		}

		// Token: 0x17000ACA RID: 2762
		// (get) Token: 0x06002C11 RID: 11281 RVA: 0x000B9371 File Offset: 0x000B7571
		public virtual TextObject IssueLordSolutionCounterOfferDeclineByPlayer
		{
			get
			{
				return TextObject.Empty;
			}
		}

		// Token: 0x17000ACB RID: 2763
		// (get) Token: 0x06002C12 RID: 11282 RVA: 0x000B9378 File Offset: 0x000B7578
		public virtual TextObject IssueLordSolutionCounterOfferAcceptResponseByOtherNpc
		{
			get
			{
				return TextObject.Empty;
			}
		}

		// Token: 0x17000ACC RID: 2764
		// (get) Token: 0x06002C13 RID: 11283 RVA: 0x000B937F File Offset: 0x000B757F
		public virtual TextObject IssueLordSolutionCounterOfferDeclineResponseByOtherNpc
		{
			get
			{
				return TextObject.Empty;
			}
		}

		// Token: 0x17000ACD RID: 2765
		// (get) Token: 0x06002C14 RID: 11284 RVA: 0x000B9386 File Offset: 0x000B7586
		public virtual TextObject IssueAsRumorInSettlement
		{
			get
			{
				return TextObject.Empty;
			}
		}

		// Token: 0x17000ACE RID: 2766
		// (get) Token: 0x06002C15 RID: 11285 RVA: 0x000B938D File Offset: 0x000B758D
		public virtual int AlternativeSolutionBaseNeededMenCount { get; }

		// Token: 0x06002C16 RID: 11286 RVA: 0x000B9395 File Offset: 0x000B7595
		public int GetTotalAlternativeSolutionNeededMenCount()
		{
			if (this.AlternativeSolutionHasScaledRequiredTroops && this.AlternativeSolutionHero != null)
			{
				return Campaign.Current.Models.IssueModel.GetTroopsRequiredForHero(this.AlternativeSolutionHero, this);
			}
			return this.AlternativeSolutionBaseNeededMenCount;
		}

		// Token: 0x17000ACF RID: 2767
		// (get) Token: 0x06002C17 RID: 11287 RVA: 0x000B93C9 File Offset: 0x000B75C9
		protected virtual int AlternativeSolutionBaseDurationInDaysInternal { get; }

		// Token: 0x06002C18 RID: 11288 RVA: 0x000B93D4 File Offset: 0x000B75D4
		public int GetTotalAlternativeSolutionDurationInDays()
		{
			if (this.AlternativeSolutionHasScaledDuration && this.AlternativeSolutionHero != null)
			{
				return (int)Campaign.Current.Models.IssueModel.GetDurationOfResolutionForHero(this.AlternativeSolutionHero, this).ToDays;
			}
			return this.AlternativeSolutionBaseDurationInDaysInternal;
		}

		// Token: 0x06002C19 RID: 11289 RVA: 0x000B941C File Offset: 0x000B761C
		public int GetBaseAlternativeSolutionDurationInDays()
		{
			return this.AlternativeSolutionBaseDurationInDaysInternal;
		}

		// Token: 0x17000AD0 RID: 2768
		// (get) Token: 0x06002C1A RID: 11290 RVA: 0x000B9424 File Offset: 0x000B7624
		// (set) Token: 0x06002C1B RID: 11291 RVA: 0x000B942C File Offset: 0x000B762C
		[SaveableProperty(25)]
		public CampaignTime AlternativeSolutionReturnTimeForTroops { get; private set; }

		// Token: 0x17000AD1 RID: 2769
		// (get) Token: 0x06002C1C RID: 11292
		public abstract bool IsThereAlternativeSolution { get; }

		// Token: 0x17000AD2 RID: 2770
		// (get) Token: 0x06002C1D RID: 11293 RVA: 0x000B9435 File Offset: 0x000B7635
		protected virtual TextObject AlternativeSolutionStartLog { get; }

		// Token: 0x17000AD3 RID: 2771
		// (get) Token: 0x06002C1E RID: 11294 RVA: 0x000B943D File Offset: 0x000B763D
		protected virtual TextObject AlternativeSolutionEndLogDefault
		{
			get
			{
				return new TextObject("{=xbvQzR2B}Your men should be on their way.", null);
			}
		}

		// Token: 0x17000AD4 RID: 2772
		// (get) Token: 0x06002C1F RID: 11295 RVA: 0x000B944A File Offset: 0x000B764A
		public bool IsThereDiscussDialogFlow
		{
			get
			{
				return this.IssueDiscussAlternativeSolution != null;
			}
		}

		// Token: 0x17000AD5 RID: 2773
		// (get) Token: 0x06002C20 RID: 11296 RVA: 0x000B9455 File Offset: 0x000B7655
		protected virtual int CompanionSkillRewardXP { get; }

		// Token: 0x17000AD6 RID: 2774
		// (get) Token: 0x06002C21 RID: 11297 RVA: 0x000B945D File Offset: 0x000B765D
		// (set) Token: 0x06002C22 RID: 11298 RVA: 0x000B9465 File Offset: 0x000B7665
		[SaveableProperty(31)]
		public CampaignTime AlternativeSolutionIssueEffectClearTime { get; private set; }

		// Token: 0x17000AD7 RID: 2775
		// (get) Token: 0x06002C23 RID: 11299 RVA: 0x000B9470 File Offset: 0x000B7670
		public Hero AlternativeSolutionHero
		{
			get
			{
				foreach (TroopRosterElement troopRosterElement in this.AlternativeSolutionSentTroops.GetTroopRoster())
				{
					if (troopRosterElement.Character.IsHero)
					{
						return troopRosterElement.Character.HeroObject;
					}
				}
				return null;
			}
		}

		// Token: 0x06002C24 RID: 11300 RVA: 0x000B94E0 File Offset: 0x000B76E0
		public virtual bool AlternativeSolutionCondition(out TextObject explanation)
		{
			explanation = null;
			return true;
		}

		// Token: 0x06002C25 RID: 11301 RVA: 0x000B94E6 File Offset: 0x000B76E6
		public virtual void AlternativeSolutionStartConsequence()
		{
		}

		// Token: 0x06002C26 RID: 11302 RVA: 0x000B94E8 File Offset: 0x000B76E8
		public virtual bool DoTroopsSatisfyAlternativeSolution(TroopRoster troopRoster, out TextObject explanation)
		{
			explanation = TextObject.Empty;
			return this.IsThereAlternativeSolution && this.AlternativeSolutionBaseNeededMenCount == 1;
		}

		// Token: 0x06002C27 RID: 11303 RVA: 0x000B9504 File Offset: 0x000B7704
		protected virtual void AlternativeSolutionEndWithFailureConsequence()
		{
		}

		// Token: 0x06002C28 RID: 11304 RVA: 0x000B9506 File Offset: 0x000B7706
		protected virtual void AlternativeSolutionEndWithSuccessConsequence()
		{
		}

		// Token: 0x17000AD8 RID: 2776
		// (get) Token: 0x06002C29 RID: 11305 RVA: 0x000B9508 File Offset: 0x000B7708
		public virtual TextObject IssueDiscussAlternativeSolution { get; }

		// Token: 0x17000AD9 RID: 2777
		// (get) Token: 0x06002C2A RID: 11306 RVA: 0x000B9510 File Offset: 0x000B7710
		public virtual TextObject IssueAlternativeSolutionSuccessLog { get; }

		// Token: 0x17000ADA RID: 2778
		// (get) Token: 0x06002C2B RID: 11307 RVA: 0x000B9518 File Offset: 0x000B7718
		public virtual TextObject IssueAlternativeSolutionFailLog { get; }

		// Token: 0x06002C2C RID: 11308 RVA: 0x000B9520 File Offset: 0x000B7720
		public virtual bool IsTroopTypeNeededByAlternativeSolution(CharacterObject character)
		{
			return true;
		}

		// Token: 0x17000ADB RID: 2779
		// (get) Token: 0x06002C2D RID: 11309
		public abstract bool IsThereLordSolution { get; }

		// Token: 0x17000ADC RID: 2780
		// (get) Token: 0x06002C2E RID: 11310 RVA: 0x000B9523 File Offset: 0x000B7723
		protected virtual TextObject LordSolutionStartLog
		{
			get
			{
				return TextObject.Empty;
			}
		}

		// Token: 0x17000ADD RID: 2781
		// (get) Token: 0x06002C2F RID: 11311 RVA: 0x000B952A File Offset: 0x000B772A
		protected virtual TextObject LordSolutionCounterOfferAcceptLog
		{
			get
			{
				return TextObject.Empty;
			}
		}

		// Token: 0x17000ADE RID: 2782
		// (get) Token: 0x06002C30 RID: 11312 RVA: 0x000B9531 File Offset: 0x000B7731
		protected virtual TextObject LordSolutionCounterOfferRefuseLog
		{
			get
			{
				return TextObject.Empty;
			}
		}

		// Token: 0x17000ADF RID: 2783
		// (get) Token: 0x06002C31 RID: 11313 RVA: 0x000B9538 File Offset: 0x000B7738
		public virtual int NeededInfluenceForLordSolution { get; }

		// Token: 0x17000AE0 RID: 2784
		// (get) Token: 0x06002C32 RID: 11314 RVA: 0x000B9540 File Offset: 0x000B7740
		// (set) Token: 0x06002C33 RID: 11315 RVA: 0x000B9548 File Offset: 0x000B7748
		public virtual Hero CounterOfferHero { get; protected set; }

		// Token: 0x06002C34 RID: 11316 RVA: 0x000B9551 File Offset: 0x000B7751
		public virtual bool LordSolutionCondition(out TextObject explanation)
		{
			explanation = null;
			return true;
		}

		// Token: 0x06002C35 RID: 11317 RVA: 0x000B9557 File Offset: 0x000B7757
		protected virtual void LordSolutionConsequence()
		{
		}

		// Token: 0x06002C36 RID: 11318 RVA: 0x000B9559 File Offset: 0x000B7759
		protected virtual void LordSolutionConsequenceWithRefuseCounterOffer()
		{
		}

		// Token: 0x06002C37 RID: 11319 RVA: 0x000B955B File Offset: 0x000B775B
		protected virtual void LordSolutionConsequenceWithAcceptCounterOffer()
		{
		}

		// Token: 0x17000AE1 RID: 2785
		// (get) Token: 0x06002C38 RID: 11320 RVA: 0x000B955D File Offset: 0x000B775D
		public MBReadOnlyList<JournalLog> JournalEntries
		{
			get
			{
				return this._journalEntries;
			}
		}

		// Token: 0x17000AE2 RID: 2786
		// (get) Token: 0x06002C39 RID: 11321 RVA: 0x000B9565 File Offset: 0x000B7765
		// (set) Token: 0x06002C3A RID: 11322 RVA: 0x000B9570 File Offset: 0x000B7770
		public Hero IssueOwner
		{
			get
			{
				return this._issueOwner;
			}
			set
			{
				Hero issueOwner = this._issueOwner;
				this._issueOwner = value;
				if (this.IsSolvingWithAlternative)
				{
					TextObject textObject = new TextObject("{=gmaqJZyv}You have received a message from {NEW_OWNER.LINK}:{newline}\"Sadly, {OLD_OWNER.LINK} has died. You may continue on your task, however, and report back to me.", null);
					StringHelpers.SetCharacterProperties("OLD_OWNER", issueOwner.CharacterObject, textObject, false);
					StringHelpers.SetCharacterProperties("NEW_OWNER", this._issueOwner.CharacterObject, textObject, false);
					this.AddLog(new JournalLog(CampaignTime.Now, textObject, null, 0, 0, LogType.Text));
				}
			}
		}

		// Token: 0x17000AE3 RID: 2787
		// (get) Token: 0x06002C3B RID: 11323
		public abstract TextObject Title { get; }

		// Token: 0x17000AE4 RID: 2788
		// (get) Token: 0x06002C3C RID: 11324 RVA: 0x000B95DF File Offset: 0x000B77DF
		// (set) Token: 0x06002C3D RID: 11325 RVA: 0x000B95E7 File Offset: 0x000B77E7
		[SaveableProperty(15)]
		public QuestBase IssueQuest { get; private set; }

		// Token: 0x17000AE5 RID: 2789
		// (get) Token: 0x06002C3E RID: 11326 RVA: 0x000B95F0 File Offset: 0x000B77F0
		public Settlement IssueSettlement
		{
			get
			{
				if (!this._issueOwner.IsNotable)
				{
					return null;
				}
				return this.IssueOwner.CurrentSettlement;
			}
		}

		// Token: 0x17000AE6 RID: 2790
		// (get) Token: 0x06002C3F RID: 11327
		public abstract TextObject Description { get; }

		// Token: 0x17000AE7 RID: 2791
		// (get) Token: 0x06002C40 RID: 11328 RVA: 0x000B960C File Offset: 0x000B780C
		// (set) Token: 0x06002C41 RID: 11329 RVA: 0x000B9614 File Offset: 0x000B7814
		[SaveableProperty(22)]
		public bool IsTriedToSolveBefore { get; private set; }

		// Token: 0x17000AE8 RID: 2792
		// (get) Token: 0x06002C42 RID: 11330 RVA: 0x000B961D File Offset: 0x000B781D
		public bool IsOngoingWithoutQuest
		{
			get
			{
				return this._issueState == IssueBase.IssueState.Ongoing;
			}
		}

		// Token: 0x17000AE9 RID: 2793
		// (get) Token: 0x06002C43 RID: 11331 RVA: 0x000B9628 File Offset: 0x000B7828
		public bool IsSolvingWithQuest
		{
			get
			{
				return this._issueState == IssueBase.IssueState.SolvingWithQuestSolution;
			}
		}

		// Token: 0x17000AEA RID: 2794
		// (get) Token: 0x06002C44 RID: 11332 RVA: 0x000B9633 File Offset: 0x000B7833
		public bool IsSolvingWithAlternative
		{
			get
			{
				return this._issueState == IssueBase.IssueState.SolvingWithAlternativeSolution;
			}
		}

		// Token: 0x17000AEB RID: 2795
		// (get) Token: 0x06002C45 RID: 11333 RVA: 0x000B963E File Offset: 0x000B783E
		public bool IsSolvingWithLordSolution
		{
			get
			{
				return this._issueState == IssueBase.IssueState.SolvingWithLordSolution;
			}
		}

		// Token: 0x17000AEC RID: 2796
		// (get) Token: 0x06002C46 RID: 11334 RVA: 0x000B9649 File Offset: 0x000B7849
		protected float IssueDifficultyMultiplier
		{
			get
			{
				if (this._issueDifficultyMultiplier != 0f)
				{
					return this._issueDifficultyMultiplier;
				}
				return Campaign.Current.Models.IssueModel.GetIssueDifficultyMultiplier();
			}
		}

		// Token: 0x17000AED RID: 2797
		// (get) Token: 0x06002C47 RID: 11335 RVA: 0x000B9673 File Offset: 0x000B7873
		protected virtual int RewardGold { get; }

		// Token: 0x06002C48 RID: 11336 RVA: 0x000B967B File Offset: 0x000B787B
		public float GetActiveIssueEffectAmount(IssueEffect issueEffect)
		{
			if (!this._areIssueEffectsResolved)
			{
				return this.GetIssueEffectAmountInternal(issueEffect);
			}
			return 0f;
		}

		// Token: 0x06002C49 RID: 11337 RVA: 0x000B9692 File Offset: 0x000B7892
		public virtual ValueTuple<SkillObject, int> GetAlternativeSolutionSkill(Hero hero)
		{
			return new ValueTuple<SkillObject, int>(null, 0);
		}

		// Token: 0x17000AEE RID: 2798
		// (get) Token: 0x06002C4A RID: 11338 RVA: 0x000B969B File Offset: 0x000B789B
		public virtual IssueBase.AlternativeSolutionScaleFlag AlternativeSolutionScaleFlags
		{
			get
			{
				return IssueBase.AlternativeSolutionScaleFlag.None;
			}
		}

		// Token: 0x17000AEF RID: 2799
		// (get) Token: 0x06002C4B RID: 11339 RVA: 0x000B969E File Offset: 0x000B789E
		public bool AlternativeSolutionHasCasualties
		{
			get
			{
				return this.AlternativeSolutionScaleFlags.HasAnyFlag(IssueBase.AlternativeSolutionScaleFlag.Casualties);
			}
		}

		// Token: 0x17000AF0 RID: 2800
		// (get) Token: 0x06002C4C RID: 11340 RVA: 0x000B96AC File Offset: 0x000B78AC
		public bool AlternativeSolutionHasScaledRequiredTroops
		{
			get
			{
				return this.AlternativeSolutionScaleFlags.HasAnyFlag(IssueBase.AlternativeSolutionScaleFlag.RequiredTroops);
			}
		}

		// Token: 0x17000AF1 RID: 2801
		// (get) Token: 0x06002C4D RID: 11341 RVA: 0x000B96BA File Offset: 0x000B78BA
		public bool AlternativeSolutionHasScaledDuration
		{
			get
			{
				return this.AlternativeSolutionScaleFlags.HasAnyFlag(IssueBase.AlternativeSolutionScaleFlag.Duration);
			}
		}

		// Token: 0x17000AF2 RID: 2802
		// (get) Token: 0x06002C4E RID: 11342 RVA: 0x000B96C8 File Offset: 0x000B78C8
		public bool AlternativeSolutionHasFailureRisk
		{
			get
			{
				return this.AlternativeSolutionScaleFlags.HasAnyFlag(IssueBase.AlternativeSolutionScaleFlag.FailureRisk);
			}
		}

		// Token: 0x06002C4F RID: 11343 RVA: 0x000B96D6 File Offset: 0x000B78D6
		protected virtual float GetIssueEffectAmountInternal(IssueEffect issueEffect)
		{
			return 0f;
		}

		// Token: 0x06002C50 RID: 11344 RVA: 0x000B96E0 File Offset: 0x000B78E0
		protected IssueBase(Hero issueOwner, CampaignTime issueDueTime)
		{
			this._issueOwner = issueOwner;
			this.IssueDueTime = issueDueTime;
			this.IssueDiscussAlternativeSolution = null;
			this.IssueCreationTime = CampaignTime.Now;
			this._issueState = IssueBase.IssueState.Ongoing;
			this.IsTriedToSolveBefore = false;
			this.AlternativeSolutionSentTroops = TroopRoster.CreateDummyTroopRoster();
			this._journalEntries = new MBList<JournalLog>();
			CampaignEvents.OnSettlementOwnerChangedEvent.AddNonSerializedListener(this, new Action<Settlement, bool, Hero, Hero, Hero, ChangeOwnerOfSettlementAction.ChangeOwnerOfSettlementDetail>(this.OnSettlementOwnerChanged));
		}

		// Token: 0x06002C51 RID: 11345 RVA: 0x000B9759 File Offset: 0x000B7959
		public override string ToString()
		{
			return base.StringId;
		}

		// Token: 0x06002C52 RID: 11346 RVA: 0x000B9761 File Offset: 0x000B7961
		public void InitializeIssueBaseOnLoad()
		{
			this.OnGameLoad();
		}

		// Token: 0x06002C53 RID: 11347 RVA: 0x000B9769 File Offset: 0x000B7969
		internal void HourlyTickWithIssueManager()
		{
			this.HourlyTick();
		}

		// Token: 0x06002C54 RID: 11348
		protected abstract void OnGameLoad();

		// Token: 0x06002C55 RID: 11349
		protected abstract void HourlyTick();

		// Token: 0x06002C56 RID: 11350
		protected abstract QuestBase GenerateIssueQuest(string questId);

		// Token: 0x06002C57 RID: 11351
		public abstract IssueBase.IssueFrequency GetFrequency();

		// Token: 0x06002C58 RID: 11352
		protected abstract bool CanPlayerTakeQuestConditions(Hero issueGiver, out IssueBase.PreconditionFlags flag, out Hero relationHero, out SkillObject skill);

		// Token: 0x06002C59 RID: 11353
		public abstract bool IssueStayAliveConditions();

		// Token: 0x06002C5A RID: 11354
		protected abstract void CompleteIssueWithTimedOutConsequences();

		// Token: 0x06002C5B RID: 11355 RVA: 0x000B9771 File Offset: 0x000B7971
		protected virtual void AfterIssueCreation()
		{
		}

		// Token: 0x06002C5C RID: 11356 RVA: 0x000B9773 File Offset: 0x000B7973
		public virtual bool CanBeCompletedByAI()
		{
			return true;
		}

		// Token: 0x06002C5D RID: 11357 RVA: 0x000B9776 File Offset: 0x000B7976
		protected virtual void OnIssueFinalized()
		{
		}

		// Token: 0x06002C5E RID: 11358 RVA: 0x000B9778 File Offset: 0x000B7978
		public virtual void OnHeroCanHaveQuestOrIssueInfoIsRequested(Hero hero, ref bool result)
		{
		}

		// Token: 0x06002C5F RID: 11359 RVA: 0x000B977A File Offset: 0x000B797A
		public virtual void OnHeroCanLeadPartyInfoIsRequested(Hero hero, ref bool result)
		{
		}

		// Token: 0x06002C60 RID: 11360 RVA: 0x000B977C File Offset: 0x000B797C
		public virtual void OnHeroCanHavePartyRoleOrBeGovernorInfoIsRequested(Hero hero, ref bool result)
		{
		}

		// Token: 0x06002C61 RID: 11361 RVA: 0x000B977E File Offset: 0x000B797E
		public virtual void OnHeroCanDieInfoIsRequested(Hero hero, KillCharacterAction.KillCharacterActionDetail causeOfDeath, ref bool result)
		{
		}

		// Token: 0x06002C62 RID: 11362 RVA: 0x000B9780 File Offset: 0x000B7980
		public virtual void OnHeroCanBecomePrisonerInfoIsRequested(Hero hero, ref bool result)
		{
		}

		// Token: 0x06002C63 RID: 11363 RVA: 0x000B9782 File Offset: 0x000B7982
		public virtual void OnHeroCanBeSelectedInInventoryInfoIsRequested(Hero hero, ref bool result)
		{
		}

		// Token: 0x06002C64 RID: 11364 RVA: 0x000B9784 File Offset: 0x000B7984
		public virtual void OnHeroCanMoveToSettlementInfoIsRequested(Hero hero, ref bool result)
		{
		}

		// Token: 0x06002C65 RID: 11365 RVA: 0x000B9786 File Offset: 0x000B7986
		public virtual void OnHeroCanMarryInfoIsRequested(Hero hero, ref bool result)
		{
		}

		// Token: 0x06002C66 RID: 11366 RVA: 0x000B9788 File Offset: 0x000B7988
		public bool StartIssueWithQuest()
		{
			this._issueDifficultyMultiplier = Campaign.Current.Models.IssueModel.GetIssueDifficultyMultiplier();
			this._issueState = IssueBase.IssueState.SolvingWithQuestSolution;
			this.IssueQuest = this.GenerateIssueQuest(base.StringId + "_quest");
			this.IsTriedToSolveBefore = true;
			this.IssueDueTime = CampaignTime.Never;
			CampaignEventDispatcher.Instance.OnIssueUpdated(this, IssueBase.IssueUpdateDetails.PlayerStartedIssueQuestClassicSolution, Hero.MainHero);
			return true;
		}

		// Token: 0x06002C67 RID: 11367 RVA: 0x000B97F8 File Offset: 0x000B79F8
		public void StartIssueWithAlternativeSolution()
		{
			this._issueDifficultyMultiplier = Campaign.Current.Models.IssueModel.GetIssueDifficultyMultiplier();
			IssueModel issueModel = Campaign.Current.Models.IssueModel;
			this._failureChance = (this.AlternativeSolutionHasFailureRisk ? issueModel.GetFailureRiskForHero(this.AlternativeSolutionHero, this) : 0f);
			if (this.AlternativeSolutionHasCasualties)
			{
				ValueTuple<int, int> causalityForHero = issueModel.GetCausalityForHero(this.AlternativeSolutionHero, this);
				this._alternativeSolutionCasualtyCount = MBRandom.RandomInt(causalityForHero.Item1, causalityForHero.Item2 + 1);
			}
			else
			{
				this._alternativeSolutionCasualtyCount = 0;
			}
			this._companionRewardSkill = issueModel.GetIssueAlternativeSolutionSkill(this.AlternativeSolutionHero, this).Item1;
			this._issueState = IssueBase.IssueState.SolvingWithAlternativeSolution;
			this.IsTriedToSolveBefore = true;
			this._totalTroopXpAmount = 1000f + 500f * this.IssueDifficultyMultiplier;
			this.AlternativeSolutionReturnTimeForTroops = CampaignTime.DaysFromNow((float)this.GetTotalAlternativeSolutionDurationInDays());
			this.IssueDueTime = this.AlternativeSolutionReturnTimeForTroops;
			this.AddLog(new JournalLog(CampaignTime.Now, this.AlternativeSolutionStartLog, new TextObject("{=VFO7rMzK}Return Days", null), 0, this.AlternativeSolutionBaseDurationInDaysInternal, LogType.Text));
			this.AlternativeSolutionIssueEffectClearTime = this.AlternativeSolutionReturnTimeForTroops - CampaignTime.Days(1f);
			if (this.AlternativeSolutionIssueEffectClearTime.IsPast)
			{
				this.AlternativeSolutionIssueEffectClearTime = this.AlternativeSolutionReturnTimeForTroops;
			}
			DisableHeroAction.Apply(this.AlternativeSolutionHero);
			if (LocationComplex.Current != null)
			{
				Location locationOfCharacter = LocationComplex.Current.GetLocationOfCharacter(this.AlternativeSolutionHero);
				if (locationOfCharacter != null)
				{
					LocationCharacter locationCharacter = locationOfCharacter.GetLocationCharacter(this.AlternativeSolutionHero);
					LocationComplex.Current.ChangeLocation(locationCharacter, locationOfCharacter, null);
				}
			}
			CampaignEventDispatcher.Instance.OnIssueUpdated(this, IssueBase.IssueUpdateDetails.PlayerSentTroopsToQuest, Hero.MainHero);
		}

		// Token: 0x06002C68 RID: 11368 RVA: 0x000B9998 File Offset: 0x000B7B98
		private void MakeAlternativeSolutionTroopsReturn()
		{
			this.AlternativeSolutionHero.ChangeState(Hero.CharacterStates.Active);
			MobileParty.MainParty.MemberRoster.Add(this.AlternativeSolutionSentTroops);
			this.AlternativeSolutionSentTroops.Clear();
		}

		// Token: 0x06002C69 RID: 11369 RVA: 0x000B99C6 File Offset: 0x000B7BC6
		public void OnAlternativeSolutionSolvedAndTroopsAreReturning()
		{
			this._areIssueEffectsResolved = true;
			this.AddLog(new JournalLog(CampaignTime.Now, this.AlternativeSolutionEndLogDefault, null, 0, 0, LogType.Text));
		}

		// Token: 0x06002C6A RID: 11370 RVA: 0x000B99E9 File Offset: 0x000B7BE9
		public void IssueFinalized()
		{
			this.IssueQuest = null;
			CampaignEventDispatcher.Instance.RemoveListeners(this);
			Campaign.Current.IssueManager.DeactivateIssue(this);
			this._areIssueEffectsResolved = true;
			this.RemoveAllTrackedObjects();
			this.OnIssueFinalized();
		}

		// Token: 0x06002C6B RID: 11371 RVA: 0x000B9A20 File Offset: 0x000B7C20
		public void CompleteIssueWithQuest()
		{
			CampaignEventDispatcher.Instance.OnIssueUpdated(this, IssueBase.IssueUpdateDetails.IssueFinishedWithSuccess, this.IsTriedToSolveBefore ? Hero.MainHero : null);
			this.IssueFinalized();
		}

		// Token: 0x06002C6C RID: 11372 RVA: 0x000B9A44 File Offset: 0x000B7C44
		public void CompleteIssueWithTimedOut()
		{
			CampaignEventDispatcher.Instance.OnIssueUpdated(this, IssueBase.IssueUpdateDetails.IssueTimedOut, this.IsTriedToSolveBefore ? Hero.MainHero : null);
			this.IssueFinalized();
		}

		// Token: 0x06002C6D RID: 11373 RVA: 0x000B9A69 File Offset: 0x000B7C69
		public void CompleteIssueWithStayAliveConditionsFailed()
		{
			CampaignEventDispatcher.Instance.OnIssueUpdated(this, IssueBase.IssueUpdateDetails.IssueCancel, this.IsTriedToSolveBefore ? Hero.MainHero : null);
			this.IssueFinalized();
		}

		// Token: 0x06002C6E RID: 11374 RVA: 0x000B9A90 File Offset: 0x000B7C90
		public void CompleteIssueWithBetrayal()
		{
			if (this.IssueQuest != null && this.IssueQuest.IsOngoing)
			{
				this.IssueQuest.CompleteQuestWithBetrayal(null);
			}
			CampaignEventDispatcher.Instance.OnIssueUpdated(this, IssueBase.IssueUpdateDetails.IssueFinishedWithBetrayal, this.IsTriedToSolveBefore ? Hero.MainHero : null);
			this.IssueFinalized();
		}

		// Token: 0x06002C6F RID: 11375 RVA: 0x000B9AE0 File Offset: 0x000B7CE0
		public void CompleteIssueWithFail(TextObject log = null)
		{
			if (this.IssueQuest != null && this.IssueQuest.IsOngoing)
			{
				this.IssueQuest.CompleteQuestWithFail(log);
			}
			CampaignEventDispatcher.Instance.OnIssueUpdated(this, IssueBase.IssueUpdateDetails.IssueFail, this.IsTriedToSolveBefore ? Hero.MainHero : null);
			this.IssueFinalized();
		}

		// Token: 0x06002C70 RID: 11376 RVA: 0x000B9B30 File Offset: 0x000B7D30
		public void CompleteIssueWithCancel(TextObject log = null)
		{
			if (this.IssueQuest != null)
			{
				if (this.IssueQuest.IsOngoing)
				{
					this.IssueQuest.CompleteQuestWithCancel(log);
				}
			}
			else if (this.IsSolvingWithAlternative)
			{
				this.AddLog(new JournalLog(CampaignTime.Now, new TextObject("{=V5Za6d4h}Your troops have returned from their mission.", null), null, 0, 0, LogType.Text));
				this.MakeAlternativeSolutionTroopsReturn();
			}
			else if (this.IsSolvingWithLordSolution && log != null)
			{
				this.AddLog(new JournalLog(CampaignTime.Now, log, null, 0, 0, LogType.Text));
			}
			CampaignEventDispatcher.Instance.OnIssueUpdated(this, IssueBase.IssueUpdateDetails.IssueCancel, this.IsTriedToSolveBefore ? Hero.MainHero : null);
			this.IssueFinalized();
		}

		// Token: 0x06002C71 RID: 11377 RVA: 0x000B9BD2 File Offset: 0x000B7DD2
		public void CompleteIssueWithAiLord(Hero issueSolver)
		{
			CampaignEventDispatcher.Instance.OnIssueUpdated(this, IssueBase.IssueUpdateDetails.IssueFinishedByAILord, issueSolver);
			this.IssueFinalized();
		}

		// Token: 0x06002C72 RID: 11378 RVA: 0x000B9BE8 File Offset: 0x000B7DE8
		private void AlternativeSolutionEndWithSuccess()
		{
			if (this.AlternativeSolutionHero == null)
			{
				Debug.Print("AlternativeSolutionHero is null for " + base.StringId, 0, Debug.DebugColor.White, 17592186044416UL);
				Debug.Print("AlternativeSolutionSentTroops:", 0, Debug.DebugColor.White, 17592186044416UL);
				foreach (TroopRosterElement troopRosterElement in this.AlternativeSolutionSentTroops.GetTroopRoster())
				{
					Debug.Print(string.Concat(new object[]
					{
						"troop id: ",
						troopRosterElement.Character.StringId,
						" count:",
						troopRosterElement.Number
					}), 0, Debug.DebugColor.White, 17592186044416UL);
				}
			}
			int totalManCount = this.AlternativeSolutionSentTroops.TotalManCount;
			this.AlternativeSolutionSentTroops.KillNumberOfNonHeroTroopsRandomly(this._alternativeSolutionCasualtyCount);
			float num = 0.5f;
			float num2 = 1.2f - (float)this.AlternativeSolutionBaseNeededMenCount / (float)this.AlternativeSolutionSentTroops.TotalManCount;
			foreach (FlattenedTroopRosterElement flattenedTroopRosterElement in this.AlternativeSolutionSentTroops.ToFlattenedRoster())
			{
				if (this.AlternativeSolutionBaseNeededMenCount < this.AlternativeSolutionSentTroops.TotalManCount)
				{
					num /= num2 * 0.9f + MBRandom.RandomFloat * 0.1f;
				}
				if (MBRandom.RandomFloat < num)
				{
					this.AlternativeSolutionSentTroops.WoundTroop(flattenedTroopRosterElement.Troop, 1, default(UniqueTroopDescriptor));
				}
				if (flattenedTroopRosterElement.Troop == this.AlternativeSolutionHero.CharacterObject && this.AlternativeSolutionHero.IsAlive)
				{
					this.AlternativeSolutionHero.AddSkillXp(this._companionRewardSkill, (float)this.CompanionSkillRewardXP);
				}
				num = 0.5f;
			}
			List<TroopRosterElement> list = this.AlternativeSolutionSentTroops.GetTroopRoster().FindAll((TroopRosterElement x) => x.Character.UpgradeTargets.Length != 0 || x.Character.IsHero);
			int num3 = MBRandom.RandomInt(1, list.Count + 1);
			int num4 = (int)(this._totalTroopXpAmount / (float)num3);
			int num5 = 0;
			while (num5 < num3 && list.Count > 0)
			{
				List<ValueTuple<TroopRosterElement, float>> list2 = new List<ValueTuple<TroopRosterElement, float>>();
				foreach (TroopRosterElement item in list)
				{
					list2.Add(new ValueTuple<TroopRosterElement, float>(item, (float)item.Number));
				}
				int index = this.AlternativeSolutionSentTroops.FindIndexOfTroop(MBRandom.ChooseWeighted<TroopRosterElement>(list2).Character);
				this.AlternativeSolutionSentTroops.SetElementXp(index, num4 + this.AlternativeSolutionSentTroops.GetElementXp(index));
				num5++;
			}
			if (this.RewardGold > 0)
			{
				GiveGoldAction.ApplyBetweenCharacters(null, Hero.MainHero, this.RewardGold, false);
			}
			if (!TextObject.IsNullOrEmpty(this.IssueAlternativeSolutionSuccessLog))
			{
				this.AddLog(new JournalLog(CampaignTime.Now, this.IssueAlternativeSolutionSuccessLog, null, 0, 0, LogType.Text));
			}
			TextObject textObject = TextObject.Empty;
			if (this._alternativeSolutionCasualtyCount > 0)
			{
				int variable = totalManCount - this._alternativeSolutionCasualtyCount;
				textObject = new TextObject("{=fCHVyxJ1}{COMPANION.LINK} reported that {?COMPANION.GENDER}she{?}he{\\?} had resolved the matter. Out of {NUMBER1} {?(NUMBER1 > 1)}troops{?}troop{\\?} you sent {NUMBER2} {?(NUMBER2 > 1)}troops{?}troop{\\?} came back safe and sound.", null);
				textObject.SetTextVariable("NUMBER1", totalManCount);
				textObject.SetTextVariable("NUMBER2", variable);
			}
			else
			{
				textObject = new TextObject("{=WOwaHClt}{COMPANION.LINK} reported that {?COMPANION.GENDER}she{?}he{\\?} had resolved the matter. {NUMBER} {?(NUMBER > 1)}troops{?}troop{\\?} you sent joined back to your party.", null);
				textObject.SetTextVariable("NUMBER", totalManCount);
			}
			StringHelpers.SetCharacterProperties("COMPANION", this.AlternativeSolutionHero.CharacterObject, textObject, false);
			this.AddLog(new JournalLog(CampaignTime.Now, textObject, null, 0, 0, LogType.Text));
			CampaignEventDispatcher.Instance.OnIssueUpdated(this, IssueBase.IssueUpdateDetails.SentTroopsFinishedQuest, Hero.MainHero);
		}

		// Token: 0x06002C73 RID: 11379 RVA: 0x000B9FB4 File Offset: 0x000B81B4
		public void StartIssueWithLordSolution()
		{
			this._issueDifficultyMultiplier = Campaign.Current.Models.IssueModel.GetIssueDifficultyMultiplier();
			if (this.LordSolutionStartLog != null && this.LordSolutionStartLog != TextObject.Empty)
			{
				this.AddLog(new JournalLog(CampaignTime.Now, this.LordSolutionStartLog, null, 0, 0, LogType.Text));
			}
			this._issueState = IssueBase.IssueState.SolvingWithLordSolution;
			this.IsTriedToSolveBefore = true;
			CampaignEvents.BeforeGameMenuOpenedEvent.AddNonSerializedListener(this, new Action<MenuCallbackArgs>(this.BeforeGameMenuOpened));
		}

		// Token: 0x06002C74 RID: 11380 RVA: 0x000BA030 File Offset: 0x000B8230
		private void BeforeGameMenuOpened(MenuCallbackArgs args)
		{
			if (this._issueState == IssueBase.IssueState.SolvingWithLordSolution && Campaign.Current.GameMenuManager.NextLocation == null && GameStateManager.Current.ActiveState is MapState)
			{
				if (this.CounterOfferHero != null)
				{
					if (this.IssueOwner.CurrentSettlement != null)
					{
						CampaignMapConversation.OpenConversation(new ConversationCharacterData(CharacterObject.PlayerCharacter, null, false, false, false, false, false, false), new ConversationCharacterData(this.CounterOfferHero.CharacterObject, null, false, false, false, false, false, false));
						return;
					}
				}
				else
				{
					this.CompleteIssueWithLordSolutionWithRefuseCounterOffer();
				}
			}
		}

		// Token: 0x06002C75 RID: 11381 RVA: 0x000BA0B1 File Offset: 0x000B82B1
		public void CompleteIssueWithAlternativeSolution()
		{
			if (MBRandom.RandomFloat > this._failureChance)
			{
				this.AlternativeSolutionEndWithSuccessConsequence();
				this.AlternativeSolutionEndWithSuccess();
			}
			else
			{
				this.AlternativeSolutionEndWithFailureConsequence();
				this.AlternativeSolutionEndWithFail();
			}
			this.MakeAlternativeSolutionTroopsReturn();
			this.IssueFinalized();
		}

		// Token: 0x06002C76 RID: 11382 RVA: 0x000BA0E8 File Offset: 0x000B82E8
		private void AlternativeSolutionEndWithFail()
		{
			TextObject textObject = TextObject.Empty;
			int totalManCount = this.AlternativeSolutionSentTroops.TotalManCount;
			if (this.AlternativeSolutionHasCasualties)
			{
				this.AlternativeSolutionSentTroops.KillNumberOfNonHeroTroopsRandomly(this._alternativeSolutionCasualtyCount);
				this.AlternativeSolutionHero.MakeWounded(null, KillCharacterAction.KillCharacterActionDetail.None);
			}
			if (this.AlternativeSolutionHasCasualties && this._alternativeSolutionCasualtyCount > 0)
			{
				textObject = new TextObject("{=yxwuGcDo}{COMPANION.LINK} has failed to resolve the matter. Out of {NUMBER1} troops you sent {NUMBER2} troops came back safe and sound.", null);
				textObject.SetTextVariable("NUMBER1", totalManCount);
				textObject.SetTextVariable("NUMBER2", totalManCount - this._alternativeSolutionCasualtyCount);
			}
			else
			{
				textObject = new TextObject("{=k6fpAw92}{COMPANION.LINK} has failed to resolve the matter. {NUMBER} troops came back safe and sound.", null);
				textObject.SetTextVariable("NUMBER", totalManCount);
			}
			if (!TextObject.IsNullOrEmpty(this.IssueAlternativeSolutionFailLog))
			{
				this.AddLog(new JournalLog(CampaignTime.Now, this.IssueAlternativeSolutionFailLog, null, 0, 0, LogType.Text));
			}
			StringHelpers.SetCharacterProperties("COMPANION", this.AlternativeSolutionHero.CharacterObject, null, false);
			this.AddLog(new JournalLog(CampaignTime.Now, textObject, null, 0, 0, LogType.Text));
			CampaignEventDispatcher.Instance.OnIssueUpdated(this, IssueBase.IssueUpdateDetails.SentTroopsFailedQuest, Hero.MainHero);
		}

		// Token: 0x06002C77 RID: 11383 RVA: 0x000BA1EC File Offset: 0x000B83EC
		public void CompleteIssueWithLordSolutionWithRefuseCounterOffer()
		{
			if (this.LordSolutionCounterOfferRefuseLog != null && this.LordSolutionCounterOfferRefuseLog != TextObject.Empty)
			{
				this.AddLog(new JournalLog(CampaignTime.Now, this.LordSolutionCounterOfferRefuseLog, null, 0, 0, LogType.Text));
			}
			ChangeClanInfluenceAction.Apply(Clan.PlayerClan, (float)(-(float)this.NeededInfluenceForLordSolution));
			if (this.RewardGold > 0)
			{
				GiveGoldAction.ApplyBetweenCharacters(null, Hero.MainHero, this.RewardGold, false);
			}
			this.LordSolutionConsequenceWithRefuseCounterOffer();
			this.IssueFinalized();
			CampaignEventDispatcher.Instance.OnIssueUpdated(this, IssueBase.IssueUpdateDetails.IssueFinishedWithSuccess, Hero.MainHero);
		}

		// Token: 0x06002C78 RID: 11384 RVA: 0x000BA272 File Offset: 0x000B8472
		public void CompleteIssueWithLordSolutionWithAcceptCounterOffer()
		{
			if (this.LordSolutionCounterOfferAcceptLog != null && this.LordSolutionCounterOfferAcceptLog != TextObject.Empty)
			{
				this.AddLog(new JournalLog(CampaignTime.Now, this.LordSolutionCounterOfferAcceptLog, null, 0, 0, LogType.Text));
			}
			this.LordSolutionConsequenceWithAcceptCounterOffer();
			this.CompleteIssueWithBetrayal();
		}

		// Token: 0x06002C79 RID: 11385 RVA: 0x000BA2B0 File Offset: 0x000B84B0
		internal bool CheckPreconditions(Hero issueGiver, out TextObject explanation)
		{
			explanation = new TextObject("{=!}{EXPLANATION}", null);
			if (!this.IssueStayAliveConditions() && this.IsOngoingWithoutQuest)
			{
				this.CompleteIssueWithCancel(null);
				return false;
			}
			IssueBase.PreconditionFlags preconditionFlags;
			Hero hero;
			SkillObject skillObject;
			bool result = this.CanPlayerTakeQuestConditions(issueGiver, out preconditionFlags, out hero, out skillObject);
			bool flag = false;
			if (!this.IssueQuestCanBeDuplicated)
			{
				foreach (KeyValuePair<Hero, IssueBase> keyValuePair in Campaign.Current.IssueManager.Issues)
				{
					IssueBase value = keyValuePair.Value;
					if ((value.IsSolvingWithQuest || value.IsSolvingWithAlternative) && value.GetType() == base.GetType())
					{
						flag = true;
						result = false;
					}
				}
			}
			if ((preconditionFlags & IssueBase.PreconditionFlags.AtWar) == IssueBase.PreconditionFlags.AtWar)
			{
				explanation.SetTextVariable("EXPLANATION", new TextObject("{=21dlZJt6}I don't wish to speak about that. As you know, our factions are at war.", null));
			}
			else if (flag)
			{
				explanation.SetTextVariable("EXPLANATION", new TextObject("{=HvY7wjHt}I don't think you can help me. I think you may have other, similar commitments that could interfere.", null));
			}
			else if ((preconditionFlags & IssueBase.PreconditionFlags.NotInSameFaction) == IssueBase.PreconditionFlags.NotInSameFaction)
			{
				explanation.SetTextVariable("EXPLANATION", new TextObject("{=rBPI2dvX}I don't need the service of strangers. I work only with lords of the realm and loyal mercenaries.[ib:closed][if:convo_grave]", null));
			}
			else if ((preconditionFlags & IssueBase.PreconditionFlags.MainHeroIsKingdomLeader) == IssueBase.PreconditionFlags.MainHeroIsKingdomLeader || (preconditionFlags & IssueBase.PreconditionFlags.PlayerIsOwnerOfSettlement) == IssueBase.PreconditionFlags.PlayerIsOwnerOfSettlement)
			{
				explanation.SetTextVariable("EXPLANATION", new TextObject("{=dYJKy2mO}Thank you for asking my {?PLAYER.GENDER}lady{?}lord{\\?}, but I can't bother you with such an unimportant issue.", null));
			}
			else if ((preconditionFlags & IssueBase.PreconditionFlags.ClanTier) == IssueBase.PreconditionFlags.ClanTier)
			{
				explanation.SetTextVariable("EXPLANATION", new TextObject("{=QOiPDGbf}I have never heard of your clan. I am not sure if I can rely on you or not.[ib:closed][if:convo_grave]", null));
			}
			else if ((preconditionFlags & IssueBase.PreconditionFlags.Renown) == IssueBase.PreconditionFlags.Renown)
			{
				explanation.SetTextVariable("EXPLANATION", new TextObject("{=7uJcPQnc}I don't think you can help me. I'm looking for someone with a bit more, shall we say, renown...", null));
			}
			else if ((preconditionFlags & IssueBase.PreconditionFlags.Relation) == IssueBase.PreconditionFlags.Relation)
			{
				TextObject textObject;
				if (issueGiver == hero)
				{
					textObject = new TextObject("{=Cn4lnECZ}You and I do not have a good history... I don't trust you.[ib:closed][if:convo_grave]", null);
				}
				else
				{
					textObject = new TextObject("{=5ZJMa7Om}I don't think you can help me. I've heard you have a history with {HERO.LINK}, and, well, that could complicate things...[ib:closed][if:convo_grave]", null);
					StringHelpers.SetCharacterProperties("HERO", hero.CharacterObject, textObject, false);
				}
				explanation.SetTextVariable("EXPLANATION", textObject);
			}
			else if ((preconditionFlags & IssueBase.PreconditionFlags.Skill) == IssueBase.PreconditionFlags.Skill)
			{
				TextObject textObject2 = new TextObject("{=S9yUBtKc}I don't think you can help me. You need to have some experience in {SKILL_NAME}...", null);
				textObject2.SetTextVariable("SKILL_NAME", skillObject.Name);
				explanation.SetTextVariable("EXPLANATION", textObject2);
			}
			else if ((preconditionFlags & IssueBase.PreconditionFlags.Money) == IssueBase.PreconditionFlags.Money)
			{
				explanation.SetTextVariable("EXPLANATION", new TextObject("{=GhcUKfbJ}I don't think you can help me. I need someone who has some gold to spend...[ib:closed]", null));
			}
			else if ((preconditionFlags & IssueBase.PreconditionFlags.Influence) == IssueBase.PreconditionFlags.Influence)
			{
				explanation.SetTextVariable("EXPLANATION", new TextObject("{=b6Zc1yre}I don't think you can help me. You'd need a bit of influence...", null));
			}
			else if ((preconditionFlags & IssueBase.PreconditionFlags.Wounded) == IssueBase.PreconditionFlags.Wounded)
			{
				explanation.SetTextVariable("EXPLANATION", new TextObject("{=BUf9WeyN}I don't think you can help me. You should rest for a while and let your wounds heal.", null));
			}
			else if ((preconditionFlags & IssueBase.PreconditionFlags.NotEnoughTroops) == IssueBase.PreconditionFlags.NotEnoughTroops)
			{
				explanation.SetTextVariable("EXPLANATION", new TextObject("{=dCv4Qbr6}I don't think you can help me. You don't have enough troops for this task.", null));
			}
			else if ((preconditionFlags & IssueBase.PreconditionFlags.PartySizeLimit) == IssueBase.PreconditionFlags.PartySizeLimit)
			{
				explanation.SetTextVariable("EXPLANATION", new TextObject("{=yaiQgyfB}I was planning to give you some troops to solve this task but it seems like you would have difficulties taking any more into your company.", null));
			}
			else if ((preconditionFlags & IssueBase.PreconditionFlags.ClanIsMercenary) == IssueBase.PreconditionFlags.ClanIsMercenary)
			{
				explanation.SetTextVariable("EXPLANATION", new TextObject("{=vz4M8SRn}I do have one particular task, but it is not really suited to a mercenary.Please carry on with your other duties.", null));
			}
			else
			{
				explanation.SetTextVariable("EXPLANATION", TextObject.Empty);
			}
			return result;
		}

		// Token: 0x06002C7A RID: 11386 RVA: 0x000BA5F4 File Offset: 0x000B87F4
		internal void AfterCreation()
		{
			this.AfterIssueCreation();
		}

		// Token: 0x06002C7B RID: 11387 RVA: 0x000BA5FC File Offset: 0x000B87FC
		public void InitializeIssueOnSettlementOwnerChange()
		{
			if (this.IsThereLordSolution)
			{
				Campaign.Current.ConversationManager.RemoveRelatedLines(this);
			}
		}

		// Token: 0x06002C7C RID: 11388 RVA: 0x000BA616 File Offset: 0x000B8816
		private void OnSettlementOwnerChanged(Settlement settlement, bool openToClaim, Hero newOwner, Hero oldOwner, Hero capturerHero, ChangeOwnerOfSettlementAction.ChangeOwnerOfSettlementDetail detail)
		{
			if (this.IssueSettlement == settlement || (this.IssueSettlement == null && this.IssueOwner.CurrentSettlement == settlement && this.IssueOwner.IsNoncombatant))
			{
				Campaign.Current.ConversationManager.RemoveRelatedLines(this);
			}
		}

		// Token: 0x06002C7D RID: 11389 RVA: 0x000BA654 File Offset: 0x000B8854
		public void AddLog(JournalLog log)
		{
			this._journalEntries.Add(log);
			CampaignEventDispatcher.Instance.OnIssueLogAdded(this, false);
		}

		// Token: 0x06002C7E RID: 11390 RVA: 0x000BA670 File Offset: 0x000B8870
		private void RemoveAllTrackedObjects()
		{
			foreach (ITrackableCampaignObject obj in this._trackedObjects)
			{
				Campaign.Current.VisualTrackerManager.RemoveTrackedObject(obj, false);
			}
			this._trackedObjects.Clear();
		}

		// Token: 0x06002C7F RID: 11391 RVA: 0x000BA6D8 File Offset: 0x000B88D8
		public void AddTrackedObject(ITrackableCampaignObject o)
		{
			this._trackedObjects.Add(o);
			Campaign.Current.VisualTrackerManager.RegisterObject(o);
		}

		// Token: 0x06002C80 RID: 11392 RVA: 0x000BA6F8 File Offset: 0x000B88F8
		public void ToggleTrackedObjects(bool enableTrack)
		{
			if (enableTrack)
			{
				using (List<ITrackableCampaignObject>.Enumerator enumerator = this._trackedObjects.GetEnumerator())
				{
					while (enumerator.MoveNext())
					{
						ITrackableCampaignObject obj = enumerator.Current;
						Campaign.Current.VisualTrackerManager.RegisterObject(obj);
					}
					return;
				}
			}
			foreach (ITrackableCampaignObject obj2 in this._trackedObjects)
			{
				Campaign.Current.VisualTrackerManager.RemoveTrackedObject(obj2, false);
			}
		}

		// Token: 0x04000D42 RID: 3394
		public const int IssueRelatedConversationPriority = 125;

		// Token: 0x04000D44 RID: 3396
		[SaveableField(27)]
		private float _totalTroopXpAmount;

		// Token: 0x04000D48 RID: 3400
		[SaveableField(30)]
		public readonly TroopRoster AlternativeSolutionSentTroops;

		// Token: 0x04000D4B RID: 3403
		[SaveableField(35)]
		private SkillObject _companionRewardSkill;

		// Token: 0x04000D52 RID: 3410
		[SaveableField(14)]
		private readonly MBList<JournalLog> _journalEntries;

		// Token: 0x04000D53 RID: 3411
		[SaveableField(11)]
		private IssueBase.IssueState _issueState;

		// Token: 0x04000D54 RID: 3412
		[SaveableField(12)]
		public CampaignTime IssueDueTime;

		// Token: 0x04000D55 RID: 3413
		[SaveableField(16)]
		public CampaignTime IssueCreationTime;

		// Token: 0x04000D56 RID: 3414
		[SaveableField(13)]
		private Hero _issueOwner;

		// Token: 0x04000D59 RID: 3417
		[SaveableField(26)]
		private float _issueDifficultyMultiplier;

		// Token: 0x04000D5B RID: 3419
		[SaveableField(32)]
		private bool _areIssueEffectsResolved;

		// Token: 0x04000D5C RID: 3420
		[SaveableField(33)]
		private int _alternativeSolutionCasualtyCount;

		// Token: 0x04000D5D RID: 3421
		[SaveableField(34)]
		private float _failureChance;

		// Token: 0x04000D5E RID: 3422
		[SaveableField(31)]
		private readonly List<ITrackableCampaignObject> _trackedObjects = new List<ITrackableCampaignObject>();

		// Token: 0x020005F0 RID: 1520
		internal enum IssueState
		{
			// Token: 0x04001874 RID: 6260
			Ongoing,
			// Token: 0x04001875 RID: 6261
			SolvingWithQuestSolution,
			// Token: 0x04001876 RID: 6262
			SolvingWithAlternativeSolution,
			// Token: 0x04001877 RID: 6263
			SolvingWithLordSolution
		}

		// Token: 0x020005F1 RID: 1521
		[Flags]
		public enum AlternativeSolutionScaleFlag : uint
		{
			// Token: 0x04001879 RID: 6265
			None = 0U,
			// Token: 0x0400187A RID: 6266
			Duration = 1U,
			// Token: 0x0400187B RID: 6267
			RequiredTroops = 2U,
			// Token: 0x0400187C RID: 6268
			Casualties = 4U,
			// Token: 0x0400187D RID: 6269
			FailureRisk = 8U
		}

		// Token: 0x020005F2 RID: 1522
		[Flags]
		protected enum PreconditionFlags : uint
		{
			// Token: 0x0400187F RID: 6271
			None = 0U,
			// Token: 0x04001880 RID: 6272
			Relation = 1U,
			// Token: 0x04001881 RID: 6273
			Skill = 2U,
			// Token: 0x04001882 RID: 6274
			Money = 4U,
			// Token: 0x04001883 RID: 6275
			Renown = 8U,
			// Token: 0x04001884 RID: 6276
			Influence = 16U,
			// Token: 0x04001885 RID: 6277
			Wounded = 32U,
			// Token: 0x04001886 RID: 6278
			AtWar = 64U,
			// Token: 0x04001887 RID: 6279
			ClanTier = 128U,
			// Token: 0x04001888 RID: 6280
			NotEnoughTroops = 256U,
			// Token: 0x04001889 RID: 6281
			NotInSameFaction = 512U,
			// Token: 0x0400188A RID: 6282
			PartySizeLimit = 1024U,
			// Token: 0x0400188B RID: 6283
			ClanIsMercenary = 2048U,
			// Token: 0x0400188C RID: 6284
			MainHeroIsKingdomLeader = 16384U,
			// Token: 0x0400188D RID: 6285
			PlayerIsOwnerOfSettlement = 32768U
		}

		// Token: 0x020005F3 RID: 1523
		public enum IssueUpdateDetails
		{
			// Token: 0x0400188F RID: 6287
			None,
			// Token: 0x04001890 RID: 6288
			PlayerStartedIssueQuestClassicSolution,
			// Token: 0x04001891 RID: 6289
			PlayerSentTroopsToQuest,
			// Token: 0x04001892 RID: 6290
			SentTroopsFinishedQuest,
			// Token: 0x04001893 RID: 6291
			SentTroopsFailedQuest,
			// Token: 0x04001894 RID: 6292
			IssueFinishedWithSuccess,
			// Token: 0x04001895 RID: 6293
			IssueFinishedWithBetrayal,
			// Token: 0x04001896 RID: 6294
			IssueFinishedByAILord,
			// Token: 0x04001897 RID: 6295
			IssueFail,
			// Token: 0x04001898 RID: 6296
			IssueCancel,
			// Token: 0x04001899 RID: 6297
			IssueTimedOut
		}

		// Token: 0x020005F4 RID: 1524
		public enum IssueFrequency
		{
			// Token: 0x0400189B RID: 6299
			VeryCommon,
			// Token: 0x0400189C RID: 6300
			Common,
			// Token: 0x0400189D RID: 6301
			Rare
		}
	}
}
